import type { Request, Response } from "express";
import type { RouterConf } from "../types";
import commonRes from "@/utils/commonRes";
import Mock from "mockjs";

const routes: Array<RouterConf> = [
  {
    path: "/mock_test",
    router: async (req: Request, res: Response) => {
      let data = Mock.mock({
        id: "@id()", // 随机id
        username: "@cname()", // 随机中文名字
        data: "@date()", // 随机生成日期
        avatar: "@image('')", // 图像
        description: "@paragraph()", // 描述
        ip: "@ip()", // ip
        email: "@email()", // email
      });
      commonRes(res, data, { type: "SUCCESS", message: "请求成功" });
    },
  },
];

export default routes;
